<template>
    <div class="admin_head">
        <h2>博客管理系统</h2>
        <div class="admin_h_c">
            <img :src="img_" alt="">
            <div style="margin-top: auto">
                <h3>{{moment}}</h3>
                <p>Name: <slot name="name">用户名字</slot></p>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    name: "AdminInfo",
    props:['img_'],
    data(){
        return{
            moment:"",
        }
    },
    mounted() {
                let data = new Date();
                if(data.getHours() >=6  && data.getHours() < 8)
                    this.moment = "早上好！";
                else if(data.getHours() >= 12 && data.getHours() < 14 )
                    this.moment = "中午好！";
                else if(data.getHours() >= 14 && data.getHours() < 18 )
                    this.moment  = "下午好！";
                else if(data.getHours() >= 18 || data.getHours() < 6)
                    this.moment  = "晚上好！";
                else this.moment  = "上午好！";

    }

}
</script>

<style scoped>
.admin_head{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
}
.admin_head h2{
    font-size: 20px;
    font-weight: 700;
    width: 100%;
    text-align: center;
    margin-top: 20px;
    margin-bottom: 5px;
    color: white;
}
h3{
    color: #f8f4f4;
}
.admin_head img{
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-right: 5px;
    object-fit: cover;
}
.admin_h_c{
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px 5px;
}
.admin_h_c p{
    color: white;
    font-size: 15px;
    width:145px;
    overflow: hidden;  /*超出部分隐藏*/
    white-space: nowrap;  /*禁止换行*/
    text-overflow: ellipsis; /*省略号*/
    margin-top: 5px;
}

</style>